package cl.xintec.utils
{
	public class FormatterUtil10
	{
		import mx.formatters.NumberFormatter;
		import mx.controls.TextInput;
		
		import cl.bcx.scotiabank.gploc.utils.module.IModuleInterface10;
		
		private static var _THOUSANDS_SEPARATOR:String = ",";
		private static var _DECIMALS_SEPARATOR:String = ".";
		private static var _USE_THOUSANSANDS_SEPARATOR:Boolean = true;
		private static var _PRECISION:int = 2;

		public static function set THOUSANDS_SEPARATOR(value:String):void {
			_THOUSANDS_SEPARATOR = value;
		}
		
		public static function get THOUSANDS_SEPARATOR():String {
			return _THOUSANDS_SEPARATOR;
		}

		public static function set DECIMALS_SEPARATOR(value:String):void {
			_DECIMALS_SEPARATOR = value;
		}
		
		public static function get DECIMALS_SEPARATOR():String {
			return _DECIMALS_SEPARATOR;
		}

		public static function set USE_THOUSANSANDS_SEPARATOR(value:Boolean):void {
			_USE_THOUSANSANDS_SEPARATOR = value;
		}
		
		public static function get USE_THOUSANSANDS_SEPARATOR():Boolean {
			return _USE_THOUSANSANDS_SEPARATOR;
		}

		public static function set PRECISION(value:int):void {
			_PRECISION = value;
		}
		
		public static function get PRECISION():int {
			return _PRECISION;
		}
		
		public function FormatterUtil10()
		{
		}

  		public static function formatNumber(valor:String):String {
  			var nf:NumberFormatter = new NumberFormatter();
  			nf.useThousandsSeparator = _USE_THOUSANSANDS_SEPARATOR;
  			nf.decimalSeparatorFrom = _DECIMALS_SEPARATOR;
  			nf.decimalSeparatorTo = _DECIMALS_SEPARATOR;
  			nf.thousandsSeparatorFrom = _THOUSANDS_SEPARATOR;
  			nf.thousandsSeparatorTo = _THOUSANDS_SEPARATOR;
  			nf.precision = _PRECISION;
  			return nf.format(valor);
  		}

  		public static function formatNumberNative(valor:String):Number {
  			var nf:NumberFormatter = new NumberFormatter();
  			nf.useThousandsSeparator = false;
  			nf.decimalSeparatorFrom = ",";
  			nf.decimalSeparatorTo   = "."
  			nf.precision = _PRECISION;
  			return Number(nf.format(valor));
  		}

	}
}